local ChatLayer = class("LoadingLayer",function()
    return cc.Layer:create()
end)

function ChatLayer.create()
    local layer = ChatLayer.new()
    layer:init( )
    return layer
end

function ChatLayer:ctor()

end

function ChatLayer:init()
    self:initWithParas()
    
    self.m_Json = ccs.GUIReader:getInstance():widgetFromJsonFile("image/ui/Json/LayerChat.json")
    self:setContentSize(self.m_Json:getContentSize())
    self.m_Json:setPositionX(-self.m_Json:getContentSize().width/2)
    self.m_Json:setPositionY(-self.m_Json:getContentSize().height/2)
    self:addChild(self.m_Json)
    
    self.m_ScrollView = self.m_Json:getChildByName("ScrollView")
    self.m_TextFieldChatContent = self.m_Json:getChildByName("tf_Chat")
    
    self.m_BtnNormal = ccui.Helper:seekWidgetByName(self.m_Json,"bt_Normal")  --常用语
    self.m_BtnNormal:setTouchEnabled(true)
    self.m_BtnNormal:addTouchEventListener(function(sender,eventType)self:onMenutClick(sender,eventType) end)
    
    self.m_BtnExpression = ccui.Helper:seekWidgetByName(self.m_Json,"bt_Image")  --表情
    self.m_BtnExpression:setTouchEnabled(true)
    self.m_BtnExpression:addTouchEventListener(function(sender,eventType)self:onMenutClick(sender,eventType) end)
    
    self.m_BtnSend = ccui.Helper:seekWidgetByName(self.m_Json,"bt_Send")  --发送
    self.m_BtnSend:setTouchEnabled(true)
    self.m_BtnSend:addTouchEventListener(function(sender,eventType)self:onMenutClick(sender,eventType) end)
  
    self.m_ImageViewchatBg = self.m_Json:getChildByName("im_bg")
    self.m_Panel = self.m_Json:getChildByName("Panel")
  
end


function ChatLayer:onMenutClick(sender,eventType)
    if eventType == ccui.TouchEventType.ended then
        if sender == self.m_BtnNormal then     
            print "=========ChatLayer:onMenutClick m_BtnNormal======================="
        elseif sender == self.m_BtnExpression then     
            print "=========ChatLayer:onMenutClick m_BtnExpression======================="
        elseif sender == self.m_BtnSend then     
            print "=========ChatLayer:onMenutClick m_BtnSend======================="
        end
    end
end
 
return ChatLayer